package com.gandong8.hbase.tool.domain;

import lombok.Getter;

public enum HbaseFieldTypeEnum {
    STRING("java.lang.String", ""),
    INTEGER("java.lang.Integer", "valueOf"),
    LONG("java.lang.Long", "valueOf"),
    DATE("java.util.Date", "Date"),
    DOUBLE("java.lang.Double", "valueOf"),
    BYTE("java.lang.Byte", "valueOf"),
    BOOLEAN("java.lang.Boolean", "valueOf"),
    BIGDECIMAL("java.math.BigDecimal", "new"),
    ;

    @Getter
    private String typeName;

    @Getter
    private String methodName;

    HbaseFieldTypeEnum(String typeName, String methodName) {
        this.typeName = typeName;
        this.methodName = methodName;
    }

    public static boolean contains(String typeName) {
        for (HbaseFieldTypeEnum type : HbaseFieldTypeEnum.values()) {
            if(type.typeName.equals(typeName)) {
                return true;
            }
        }
        return false;
    }

    public static HbaseFieldTypeEnum get(String typeName) {
        for (HbaseFieldTypeEnum type : HbaseFieldTypeEnum.values()) {
            if(type.typeName.equals(typeName)) {
                return type;
            }
        }
        return null;
    }



}
